package com.neulogistics.contrib.procuredcenter.infrastructure.persistence.orm.po;

import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;

import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;

/**
 * 供应商表
 * @TableName tb_vendor
 */
@TableName(value ="tb_vendor", autoResultMap = true)
@Data
public class VendorPO implements Serializable {
    /**
     * 供应商id
     */
    @TableId(value = "vendor_id", type = IdType.AUTO)
    private Integer vendorId;

    /**
     * 供应商名称
     */
    @TableField(value = "vendor_name", condition = SqlCondition.LIKE)
    private String vendorName;

    /**
     * 地址{省，市，区，详细}
     */
    @TableField(value = "vendor_address", typeHandler = JacksonTypeHandler.class)
    private JSONObject vendorAddress;

    /**
     * 联系人
     */
    @TableField(value = "vendor_contact", condition = SqlCondition.LIKE)
    private String vendorContact;

    /**
     * 联系电话
     */
    @TableField(value = "vendor_phone", condition = SqlCondition.LIKE)
    private String vendorPhone;

    /**
     * 开户行
     */
    @TableField(value = "vendor_account_bank", condition = SqlCondition.LIKE)
    private String vendorAccountBank;

    /**
     * 银行账号
     */
    @TableField(value = "vendor_account", condition = SqlCondition.LIKE)
    private String vendorAccount;

    /**
     * 邮件地址
     */
    @TableField(value = "vendor_email")
    private String vendorEmail;

    /**
     * 邮编
     */
    @TableField(value = "vendor_zip")
    private String vendorZip;

    /**
     * 法人
     */
    @TableField(value = "vendor_legal_person", condition = SqlCondition.LIKE)
    private String vendorLegalPerson;

    /**
     * 备注
     */
    @TableField(value = "vendor_remark")
    private String vendorRemark;

    /**
     * 是否删除
     */
    @TableField(value = "deleted")
    @TableLogic(value = "0", delval = "1")
    private Integer deleted;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        VendorPO other = (VendorPO) that;
        return (this.getVendorId() == null ? other.getVendorId() == null : this.getVendorId().equals(other.getVendorId()))
            && (this.getVendorName() == null ? other.getVendorName() == null : this.getVendorName().equals(other.getVendorName()))
            && (this.getVendorAddress() == null ? other.getVendorAddress() == null : this.getVendorAddress().equals(other.getVendorAddress()))
            && (this.getVendorContact() == null ? other.getVendorContact() == null : this.getVendorContact().equals(other.getVendorContact()))
            && (this.getVendorPhone() == null ? other.getVendorPhone() == null : this.getVendorPhone().equals(other.getVendorPhone()))
            && (this.getVendorAccountBank() == null ? other.getVendorAccountBank() == null : this.getVendorAccountBank().equals(other.getVendorAccountBank()))
            && (this.getVendorAccount() == null ? other.getVendorAccount() == null : this.getVendorAccount().equals(other.getVendorAccount()))
            && (this.getVendorEmail() == null ? other.getVendorEmail() == null : this.getVendorEmail().equals(other.getVendorEmail()))
            && (this.getVendorZip() == null ? other.getVendorZip() == null : this.getVendorZip().equals(other.getVendorZip()))
            && (this.getVendorLegalPerson() == null ? other.getVendorLegalPerson() == null : this.getVendorLegalPerson().equals(other.getVendorLegalPerson()))
            && (this.getVendorRemark() == null ? other.getVendorRemark() == null : this.getVendorRemark().equals(other.getVendorRemark()))
            && (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getVendorId() == null) ? 0 : getVendorId().hashCode());
        result = prime * result + ((getVendorName() == null) ? 0 : getVendorName().hashCode());
        result = prime * result + ((getVendorAddress() == null) ? 0 : getVendorAddress().hashCode());
        result = prime * result + ((getVendorContact() == null) ? 0 : getVendorContact().hashCode());
        result = prime * result + ((getVendorPhone() == null) ? 0 : getVendorPhone().hashCode());
        result = prime * result + ((getVendorAccountBank() == null) ? 0 : getVendorAccountBank().hashCode());
        result = prime * result + ((getVendorAccount() == null) ? 0 : getVendorAccount().hashCode());
        result = prime * result + ((getVendorEmail() == null) ? 0 : getVendorEmail().hashCode());
        result = prime * result + ((getVendorZip() == null) ? 0 : getVendorZip().hashCode());
        result = prime * result + ((getVendorLegalPerson() == null) ? 0 : getVendorLegalPerson().hashCode());
        result = prime * result + ((getVendorRemark() == null) ? 0 : getVendorRemark().hashCode());
        result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", vendorId=").append(vendorId);
        sb.append(", vendorName=").append(vendorName);
        sb.append(", vendorAddress=").append(vendorAddress);
        sb.append(", vendorContact=").append(vendorContact);
        sb.append(", vendorPhone=").append(vendorPhone);
        sb.append(", vendorAccountBank=").append(vendorAccountBank);
        sb.append(", vendorAccount=").append(vendorAccount);
        sb.append(", vendorEmail=").append(vendorEmail);
        sb.append(", vendorZip=").append(vendorZip);
        sb.append(", vendorLegalPerson=").append(vendorLegalPerson);
        sb.append(", vendorRemark=").append(vendorRemark);
        sb.append(", deleted=").append(deleted);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}